package com.qfjy.controller;

import com.baidu.fsg.uid.UidGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @ClassName DemoController
 * @Description TODO
 * @Author guoweixin
 * @Version 1.0
 */
@Controller
@ResponseBody
@Slf4j
public class DemoController {

    @Resource(name="cachedUidGenerator")
    private UidGenerator uidGenerator;

    @GetMapping("uid")
    public Object generatorId(){
        Set<Long> set=new HashSet<>(100000);
        log.info("开始--->");

        for(int i=0;i<100000;i++){
            set.add(uidGenerator.getUID());
        }

        log.info("----->结束---->"+set.size());

        return set;
    }

}
